package cn.wolfcode.luowowo.comment.domain;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 攻略评论
 */
@Setter
@Getter
@Document("scenery_comment")
@ToString
public class SceneryComment implements Serializable {
    @Id
    private String id;  //mongodb默认的是id
    private Long sceneryId;
    private Long userId;    //用户id
    private String username;  //用户名
    private String headUrl;     //头像
    private int level;
    private Date createTime;    //创建时间
    private String content;      //评论内容
    private String imgList;
    private int totalScore;
    private int characteristicScore;
    private int styleScore;
    private int serviceScore;
    private List<ScenicRepComment> repComments;

    public List<String> getAllImg(){
        List<String> list = new ArrayList<>();
        String[] imgStrs = this.imgList.split(",");
        for (String imgStr : imgStrs) {
            list.add(imgStr);
        }
        return list;
    }

}